package com.mall.service.marketing.controller;

import com.mall.commons.common.CommonPage;
import com.mall.commons.common.CommonResult;
import com.mall.model.domain.SmsCouponHistory;
import com.mall.service.marketing.service.CouponHistoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName CouponHistoryController
 * @Description 优惠券领取历史记录控制器
 * @Author Young
 * @Date 2023/3/11 17:00
 * @Version 1.0
 */
@RestController
@RequestMapping("/couponHistory")
public class CouponHistoryController {

    @Autowired
    private CouponHistoryService couponHistoryService;


    /**
     * 根据优惠券id，使用状态，订单编号分页获取领取记录
     *
     * 此处接参, 没有用DTO因为[陆筱竹]坚决不让, 他觉得丑
     * @return
     */
    @GetMapping("/list")
    public CommonResult list(SmsCouponHistory smsCouponHistory ,Integer pageNum,Integer pageSize){
        CommonPage commonPage = couponHistoryService.findCouponHistory(smsCouponHistory,pageNum,pageSize);
        return CommonResult.success(commonPage,"查询成功");
    }
}
